package tests;
//完全数计算
import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int num = 0;
        int count = 0;
        for(int i = 1;i <= n;i++){
            count = 0;
            for(int j = 1;j <= i;j++){
                if(i%j == 0){
                    count+=j;
                }
            }
            if(count==2*i){
                num++;
            }
        }
        System.out.println(num);
        return;
    }
}
